﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Algoritmi
{
    public class SimpleLoopCSharp : IAlgorithm
    {

        private int n = 0;
 
        #region IAlgorithm Members

        public void setParams(object[] parameters)
        {
            n = (int) parameters[0];
        }

        public void ignorePhase()
        {
        }

        public void runPhase()
        {
            //int a = 0;
            //while (a < n)
            //    a++;
            int a = 0;
            int i = 0;
            int k = (int)Math.Pow(2, 20);
            while (i++ < n)
            {
                a = (a + 3 * i) % k;
            }
        }

        public object[] getParameters(int step)
        {
            object[] parameters = new object[1];
            parameters[0] = (int)step * 256 * 1024 * 1024;
            return parameters;
        }

        public int steps()
        {
            return 8;
        }

        public string[] getParametersNames()
        {
            return new string[] { "n" };
        }

        #endregion
    }
}
